package yxy.game.pm2.bean.pubsub;

import java.util.Map;

import yxy.apple.util.PubSub.ISubscription;
import yxy.apple.util.PubSub.Publisher;
import yxy.game.pm2.bean.task.Task;

/** 任务变更发布 */
public class TaskPublisher extends Publisher {
	static private TaskPublisher instance;

	public static TaskPublisher getInstance() {
		if (instance == null) {
			instance = new TaskPublisher();
		}
		return instance;
	}

	private TaskPublisher() {

	}

	public void publish(String playerCode) {
		this.publish(new TaskSubscription(playerCode));
	}

	public static class TaskSubscription implements ISubscription {
		private String playerCode;
		private Map<String, Task> allTask;

		public TaskSubscription(String playerCode) {
			this.playerCode = playerCode;
			allTask = Task.all(playerCode);
		}

		public String getPlayerCode() {
			return playerCode;
		}

		public Map<String, Task> getAllTask() {
			return allTask;
		}

	}
}
